package com.glsc.ngateway.common.base.enums.itflow;

import lombok.AllArgsConstructor;
import lombok.Getter;

import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.Optional;

/**
 * 设备变更流程-变更类型枚举类
 * @author xuchang
 */
@Getter
@AllArgsConstructor
public enum ITEquipmentModifyFlowTypeEnum {
    //资源扩容
    RESOURCE_EXPANSION("RESOURCE_EXPANSION", "资源扩容"),
    //重新部署
    REDEPLOYMENT("REDEPLOYMENT", "重新部署"),
    //故障处理
    TROUBLESHOOTING("TROUBLESHOOTING", "故障处理"),
    //无故障协助处理
    NO_FAULT_ASSISTANCE("NO_FAULT_ASSISTANCE", "无故障协助处理"),
    //资源变更
    RESOURCE_CHANGE("RESOURCE_CHANGE", "资源变更"),
    ;

    /**
     * code
     */
    private final String code;
    /**
     * desc
     */
    private final String desc;

    public static Optional<ITEquipmentModifyFlowTypeEnum> of(@NotNull String code) {
        return Arrays.stream(ITEquipmentModifyFlowTypeEnum.values())
                .filter(o->o.getCode().equals(code))
                .findAny();
    }
}
